package com.sisyphus.spinach.core;

import androidx.lifecycle.Lifecycle;


public class NetTaskFactory {

    private NetTaskFactory() {

    }


    public static <T> INetTask.Presenter<T, INetTask.View<T>> get(
            Lifecycle lifecycle,
            INetTask.Presenter<T, INetTask.View<T>> presenter,
            INetTask.View<T> view
    ) {

        presenter.bind(view);
        lifecycle.addObserver(presenter);
        return presenter;
    }

    public static <T> INetPageTask.Presenter<T, INetPageTask.View<T>> get(
            Lifecycle lifecycle,
            INetPageTask.Presenter<T, INetPageTask.View<T>> presenter,
            INetPageTask.View<T> view
    ) {

        presenter.bind(view);
        lifecycle.addObserver(presenter);
        return presenter;
    }

}
